/* async function m() {
  // 内部会将async删除 变成正常的函数
  return new Promise((resolve) => {
    setTimeout(() => {
      resolve(123);
    }, 1000);
  });
}

m().then((res) => console.log(res));
 */

/* async function m() {
  return 123;
}

async function test() {
  const data = await m();
  console.log(data);
} */

// 转换为Promise代码
/* function m() {
  return new Promise((resolve) => resolve(123));
}

function test() {
  m().then((res) => {
    console.log(res);
  });
}

test(); */

// await 等待非promise代码，会将非promise代码封装成promise
(async function () {
  await 1; // 本质会变为为 await Promise.resolve(1)
  console.log("first");
})();
